home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / glibmm-2.4 / glibmm / timer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-20  |  1.9 KB  |  80 lines

  1. // -*- c++ -*-
  2. #ifndef _GLIBMM_TIMER_H
  3. #define _GLIBMM_TIMER_H
  4.  
  5. /* $Id: timer.h,v 1.1.1.1 2003/01/07 16:58:56 murrayc Exp $ */
  6.  
  7. /* timer.h
  8.  *
  9.  * Copyright (C) 2002 The gtkmm Development Team
  10.  *
  11.  * This library is free software; you can redistribute it and/or
  12.  * modify it under the terms of the GNU Library General Public
  13.  * License as published by the Free Software Foundation; either
  14.  * version 2 of the License, or (at your option) any later version.
  15.  *
  16.  * This library is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  19.  * Library General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU Library General Public
  22.  * License along with this library; if not, write to the Free
  23.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  */
  25.  
  26. extern "C" { typedef struct _GTimer GTimer; }
  27.  
  28.  
  29. namespace Glib
  30. {
  31.  
  32. /** Portable stop watch interface.
  33.  * This resembles a convient and portable timer with microseconds resolution.
  34.  */
  35. class Timer
  36. {
  37. public:
  38.   /** Create a new timer.
  39.    * Also starts timing by calling start() implicitly.
  40.    */
  41.   Timer();
  42.   ~Timer();
  43.  
  44.   void start();
  45.   void stop();
  46.   void reset();
  47.  
  48.   /** Get the elapsed time.
  49.    * @return The value in seconds.
  50.    */
  51.   double elapsed() const;
  52.  
  53.   /** Get the elapsed time.
  54.    * @return The value in seconds.  Also fills @p microseconds
  55.    * with the corresponding @htmlonlyµs@endhtmlonly value.
  56.    */
  57.   double elapsed(unsigned long& microseconds) const;
  58.  
  59. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  60.   GTimer*       gobj()       { return gobject_; }
  61.   const GTimer* gobj() const { return gobject_; }
  62. #endif
  63.  
  64. private:
  65.   GTimer* gobject_;
  66.  
  67.   // not copyable
  68.   Timer(const Timer&);
  69.   Timer& operator=(const Timer&);
  70. };
  71.  
  72.  
  73. void usleep(unsigned long microseconds);
  74.  
  75. } // namespace Glib
  76.  
  77.  
  78. #endif /* _GLIBMM_TIMER_H */
  79.  
  80.